package thread;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 28779
 * Date: 2023-08-13
 * Time: 16:55
 */
//多线程
class MyThread extends Thread {
    @Override
    public void run() {
        while (true) {
            System.out.println("hello world");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
public class Demo1 {
    public static void main(String[] args) throws InterruptedException {
        MyThread myThread = new MyThread();
        myThread.start();  //start启动线程
        //myThread.run();   //未调用系统api

        while (true) {
            System.out.println("hello main");
            Thread.sleep(1000);
        }
    }
}
